import React, {Component} from 'react';
import globalContext from './context'
import Child from "./components/Child";
import A from "./components/A";

class App extends Component {
    state = {userName:'zhangsan',age:18}
    changeUserName(userName){
        this.setState({
            userName
        })
    }
  render() {
      const {Provider} = globalContext
    return (
            <Provider value={{...this.state,changeUserName:this.changeUserName.bind(this)}}>
                <Child/>
                <A/>
            </Provider>
    );
  }
}

export default App;
